/**
 *
 */
package org.insia.smartposse.manager.list;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.insia.smartposse.mapping.Skills;
import org.insia.smartposse.mapping.dao.SkillsDAO;

/**
 * Class for create a Map of all Skill in Database
 *
 * @author cmougel
 *
 */
public class SkillMapManager extends HashMap {

	private final SkillsDAO _dao = new SkillsDAO();
	private HashMap<Integer, String> _skills = new HashMap<Integer, String>();

	@SuppressWarnings("unchecked")
	public SkillMapManager(){
		List<Skills> ss = _dao.findAll(_dao.getSession());
		for(Skills s : ss){
			_skills.put(s.getId(), s.getName());
		}
	}

	/**
	 * Return the map for the select Use
	 *
	 * @return
	 */
	public Map<Integer, String> getMap(){
		return _skills;
	}

	@Override
	public Object get(Object key) {
		return _skills.get(key);
	}

	@Override
	public int size() {
		return _skills.size();
	}
}
